﻿using MCPlatform.Shared.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Resources;
using MCPlatform.MotionLib.Base.AssitantClass;

namespace MCPlatform.UI.Resources.Languages
{
    public class LocalizationHelper
    {

       

        public static string GetString(LanguageEnum language, string key)
        {
            string languageName = Common.GetEnumDescription(language);
             ResourceManager resourceManager = new ResourceManager($"MCPlatform.UI.Resources.Languages.{languageName}", typeof(LocalizationHelper).Assembly);
            // 将 LanguageEnum 转换为 CultureInfo
            CultureInfo culture = new CultureInfo(languageName);

            // 获取资源字符串
            return resourceManager.GetString(key, culture) ?? key;
        }
    }
}
